package com.twu.biblioteca;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeansException;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

public class Main {

    private static final Logger LOGGER = LoggerFactory.getLogger(com.twu.biblioteca.Main.class);

    public static void main(String[] args) {
        try (AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(SpringCtxCfg.class)) {
            ctx.getBean(Biblioteca.class).run();
        } catch (BeansException e) {
            LOGGER.error("BeansExcception while running " + Biblioteca.class.getName(), e);
            System.exit(1);
        } catch (Exception e) {
            LOGGER.error("Exception thrown while running " + Biblioteca.class.getName(), e);
            System.exit(1);
        }
        System.exit(0);
    }
}
